package server;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author yangpeng
 * @time 2020/4/3
 * @since 1.0.0
 */
public class Test {
    public static void main(String[] args) throws IOException {
        File file = new File("d:/common_info.2020-04-01.log");
        BufferedReader br = new BufferedReader(new FileReader(file));
        String line ;
        int count = 0;
        while((line = br.readLine()) !=null){
            //Ew13jMNHxg EuPJSk5a40 EuPHhLzjEW

            http://t.wykz.com/s/Ew13jMNHxg
            if(line.contains("EuPHhLzjEW") || line.contains("EuPJSk5a40") || line.contains("Ew13jMNHxg")){
                count++;
                //level->C,shortUrl->Ew13jMNHxg,originalLongUrl->http://m.mokabook.cn/ereader?shareUserid=14599203&s_spid=3314_ymzxapp&bookid=1388&chapterid=1,newLongUrl->http://m.mokabook.cn/ereader?shareUserid=14599203&s_spid=3314_ymzxapp&bookid=1388&chapterid=1
                String[] split = line.split(",");
                String originalLongUrl = null;
                String newLongUrl = null;
                for (String s : split) {
                    if(s.contains("originalLongUrl")){
                        String[] arr = s.split("->");
                        originalLongUrl = arr[1];
                    }
                    if(s.contains("newLongUrl")){
                        String[] arr = s.split("->");
                        newLongUrl = arr[1];
                    }
                }
                if(originalLongUrl == null){
                    continue;
                }
                if(!originalLongUrl.trim().equals((newLongUrl.trim()))){
                    System.out.println("old:"+originalLongUrl+","+"new:"+newLongUrl);
                }
            }
        }
        System.out.println(count);
    }
}
